﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class en_Login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
    {
        string userName = Login1.UserName.ToString().Trim();
        string password = Login1.Password.ToString().Trim();
        try
        {
            String adminuser = ConfigurationManager.AppSettings["adminuser"];
            String adminpasswd = ConfigurationManager.AppSettings["adminpasswd"];

            if (userName.Equals(adminuser) && password.Equals(adminpasswd))
            {
                Login1.UserName = userName;
                e.Authenticated = true;
                ConfigurationManager.AppSettings["IsAuthenticated"] = "true";
                Response.Redirect("~/pro/en_Admin.aspx");
                //this.Server.Transfer("~/pro/en_Admin.aspx");
            }
            else
            {
                ConfigurationManager.AppSettings["IsAuthenticated"] = "false";
            }



        }
        catch (Exception) { }
        System.Web.HttpContext.Current.Response.Write("<script language='javascript'>alert('Login Failed!');</script>");
    }
}
